<template>
	<view>
		<z-paging v-if="inited && tabIndex1 == 0" ref="paging" :fixed="false" :refresher-enabled="false"
			:auto-show-back-to-top="true" :auto-clean-list-when-reload="false" :auto-scroll-to-top-when-reload="true"
			:default-page-size="5" :paging-style="{
			position:'relative',
			height: $device.measure.windowHeight - 40 - 60 + 'px'
		}" v-model="workJobs" @query="queryList">

			<!-- 轮播图 -->
			<view style="height: 120px;position: relative;padding: 10px 0;background-color: white;">
				<u-swiper radius="10" height="100" :list="list1" indicator indicatorMode="line" imgMode="aspectFill"
					:autoplay="true" :previousMargin="80" :nextMargin="80" :circular="true"></u-swiper>
			</view>

			<!-- 分类标签 -->
			<view style="background-color: #fff;height:80rpx;width: 100%;display: flex;justify-content: flex-start;">
				<u-tabs :list="tabList" @click="onTabClick" lineWidth="50rpx" lineHeight="8rpx" lineColor="#f56c6c"
					:activeStyle="{
						color: '#000000',
						fontWeight: 'bold',
						transform: 'scale(1.0)',
						fontSize:'30rpx',
						
					}" :inactiveStyle="{
						color: '#37383b',
						transform: 'scale(1.0)',
						fontSize:'28rpx'
					}" itemStyle="padding-left: 15px; padding-right: 15px;;height: 80rpx;"></u-tabs>
			</view>

			<u-sticky :offsetTop="0" :customNavHeight="0">
				<!-- 筛选标签 -->
				<view id="sticky" style="width: 100%;background-color: white;display: flex;">
					<view style="position: relative;width: 100%;">
						<!-- 选项按钮 -->
						<view style="display: flex;justify-content: flex-start;">
							<view style="display: flex;align-items: center;">
								<view
									style="border-radius: 5px;display: flex;justify-content: space-between;align-items: center;margin: 0 5px;padding:0 5px;background-color: #ebebeb66;">
									<u-icon name="map-fill"></u-icon>
									<view style="padding: 5px 5px;">佛山</view>
								</view>
							</view>

							<view style="display: flex;justify-content:flex-start;align-items:center;padding: 10px;">
								<view v-for="pin in pins" @click="pin.showTypeSel()" :style="{
										border: showPopup ? 'solid 1px #ff8901' : 'none',
										borderRadius: '100px',
										display: 'flex',
										justifyContent: 'center',
										alignItems: 'center',
										padding: '5px 15px',
										marginRight: '10px',
										color: '#9c9c9c',
										backgroundColor: pin.isCanSelect() ? (pin.isSelected()? '#ff9500' : '#fff6c7') : '#eee',
										color: pin.isCanSelect() ? (pin.isSelected()? 'white' : '#ff8901') : '#aaa',
									}">
									<view style="margin-right: 8px;font-size: 24rpx;">
										{{pin.getOption()?pin.getOption().key:'全部'}}
									</view>
									<u-icon name="arrow-down" size="12"
										:color="pin.isCanSelect() ? (pin.isSelected()? 'white' : '#ff8901') : '#aaa'"></u-icon>
								</view>
							</view>
						</view>
						<!-- 下拉菜单 -->

						<view v-for="pin in pins" style="position: absolute;z-index: 999;;overflow: hidden;width: 100%;"
							:style="{boxShadow:pin.isShowTypeSel() && pin.isCanSelect() ?'0 4px 4px 2px #77777733' : 'none'}">
							<view v-if="pin.getOptionKeys()">
								<u-transition :duration="100" :show="pin._showTypeSel" mode="fade-down">
									<view style="position: relative;background-color: #fff;padding: 0 8px 8px;">
										<view style="background-color: white;display: flex;flex-wrap:wrap;">
											<view @click="pin.setOptionKey(null)"
												style="border-radius: 5px;width: 25%;text-align: center;padding:5px;margin: 5px;"
												:style="{
													backgroundColor: pin.options_key==null? '#ffbf00' : 'aliceblue',
													color: pin.options_key==null? 'white' : 'black',
												}">
												全部
											</view>
											<view @click="pin.setOptionKey(keyName)"
												v-for=" (keyName,index) in pin.getOptionKeys()"
												style="border-radius: 5px;width: 25%;text-align: center;padding:5px;margin: 5px;"
												:style="{
													backgroundColor: pin.options_key==keyName? '#ffbf00' : 'aliceblue',
													color: pin.options_key==keyName? 'white' : 'black',
												}">
												{{keyName}}
											</view>
										</view>
									</view>
								</u-transition>
							</view>
						</view>
					</view>
				</view>

				<job-calendar @change="onClickDay">
					<template #text="{index}">
						{{itineraryText(index)}}
					</template>
				</job-calendar>
			</u-sticky>

			<!--<button style="font-size:30rpx" type='primary' open-type="getPhoneNumber"
			@getphonenumber="onPhoneNumber">获取手机号*</button> -->

			<!-- <button style="font-size:30rpx" type='primary' open-type="getUserInfo" @getuserinfo="getOpenId">获取用户OpenId*</button> -->

			<!-- <u-button @tap="animateIn = !animateIn">跳转</u-button> -->

			<!-- 分类标签 -->
			<!-- 		<view style="display: flex;background-image: linear-gradient(45deg,#fff,#fff);">
			<view style="width: 80px;border-radius: 100px;display: flex;justify-content: center;align-items: center;padding: 5px;margin-right: 10px;color: #2a2a2a;">
				<view style="margin-right: 8px;font-size: 15px;">佛山</view>
				<u-icon name="arrow-down"></u-icon>
			</view>
			
			<view style="height:45px;width: 100%;display: flex;justify-content: center;">
				<u-search :searchIconSize="50" :height="60" bgColor="#ffffff"  placeholder="搜索职位" v-model="keyword"></u-search>
			</view>
		</view> -->

			<!-- 置顶页头区域 -->

			<!-- 		<button type="default" @click="onHI" v-if="permission(['user'])">用户</button>
		<button type="default" @click="onHI" v-if="permission(['admin'])">管理员</button> -->

			<!-- 空列表 -->
			<template #empty>
				<u-empty mode="list" :icon="absUrl('/static/empty-list.jpg')" width="160" height="160" text-size="16"
					:text="(itineraryMap[currentDate] && itineraryMap[currentDate].count > 0)?'今日活动已经结束':'今日没有活动哦'">
				</u-empty>
			</template>

			<view style="background-color: #fff;padding-top: 7px;">
				<!-- 职位列表 -->
				<view v-for="(project,date) in workJobs">
					<!-- 兼职卡片 -->
					<view
						style="padding:5px 5px;box-shadow:rgb(146 146 146 / 0%) 0px 0px 4px 0px;;background-color: #fff;border-radius: 10rpx; margin: 0px 7px">
						<view class="bottom_line"
							style="display: flex;justify-content: space-between;padding: 5px 5px;">
							<!-- 左排 -->
							<view style="display: flex;justify-content: space-between;flex-direction: column;">
								<!-- 用户名片 -->
								<view style="display: flex;align-items: center;margin-bottom: 8px;">
									<view
										style="margin-right: 5px;padding:2px;border: solid 1rpx #dedede;border-radius: 100px;">
										<u-avatar size="28" :src="absUrl(project.creator.head_icon_url)"></u-avatar>
									</view>
									<span style="
								font-size: 24rpx; 
								color:#b6b6b6;">{{project.creator.nickname}}</span>
									<span style="
									background-color: #fff6c7;
									color: #ff8725;
									border-radius: 100rpx;
									padding: 6rpx 15rpx;
									margin-left: 14rpx;
									text-align: center;
									font-size: 18rpx;
									">
										企业认证
									</span>
									<view @click="onConcern(project)" class="cu-btn round" style="
										display: flex;
										align-items: center;
										border-radius: 250px;
										font-size: 26rpx;
										background-color: #fff6c7;
										color: #ff8725;
										height: 40rpx;
										width: 130rpx;
										margin-left: 5px;
									">
										关注
									</view>
								</view>
								<view style="font-size: 16px;font-weight: bolder;margin-bottom: 10rpx;">
									{{project.title}}
								</view>
							</view>

							<!-- 右排 -->
							<view style="display:flex;flex: 0 0 20%;">
								<view
									style="display:flex;flex-direction: column;justify-content: space-between;padding: 5px 0px;">
									<view>顺德.乐从</view>
									<view @click="onConfirm(project)" class="cu-btn round" style="
										display: flex;
										border-radius: 250px;
										font-size: 28rpx;
										background-color: #ff8725;
										color: white;
										height: 50rpx;
										width: 140rpx;
									">
										详情
									</view>
								</view>
							</view>
						</view>

						<!-- 班次时间 -->
						<view style="">
							<view class="bottom_line" v-for="(formData,index) in project.jobs"
								style="display: flex;justify-content: space-between;align-items:center;line-height: 12px;padding: 0px 0px;">
								<!-- 内容区域 -->
								<view style="flex: 1 0 0%;display: flex;flex-direction: column;padding: 2px;">
									<view
										style="padding: 8px;display: flex;justify-content: space-between;align-items: center;flex-wrap: nowrap;">
										<!-- 职位名称 -->
										<view style="flex: 1 1 55%;display: flex;justify-content: space-between;">
											<view style="font-size: 13px;font-weight: bold;white-space: nowrap;">
												<text>{{formData.name}}</text></view>
										</view>
										<!-- 时间 -->
										<view style="flex:0 0 45%;text-align: right;color:#000">
											<view style="line-height: 13px;font-size: 13px;white-space: nowrap;">
												<text>{{fixedTime(formData.start_time)}}-{{fixedTime(formData.end_time)}}</text>
											</view>
										</view>
									</view>

									<view style="display: flex;justify-content: space-between;padding:0px 3px;">
										<!-- 								<view>
										<view style="margin: 5px 3px;padding: 2px 5px;border-radius: 50px;color:white;background-color: #ffa200;font-size: 10px;display: inline-block">
											<text>男生</text>
										</view>
										<view style="margin: 5px 3px;padding: 2px 5px;border-radius: 50px;color:white;background-color: #ffa200;font-size: 10px;display: inline-block">
											<text>155以上</text>
										</view>
										<view style="margin: 5px 3px;padding: 2px 5px;border-radius: 50px;color:white;background-color: #ffa200;font-size: 10px;display: inline-block">
											<text>16岁</text>
										</view>
										<view style="margin: 5px 3px;padding: 2px 5px;border-radius: 50px;color:white;background-color: #ffa200;font-size: 10px;display: inline-block">
											<text>高中</text>
										</view>
									</view> -->

										<!-- <view style="display: flex;justify-content: space-between;align-items:flex-start;padding-top: 5px;"> -->
										<!-- 工资 -->
										<!-- 	<view style="font-weight: bold;color: #f00;font-size: 13px;white-space: nowrap;">
											<span>{{formData.price}}元/{{formData.price_type}}</span>
											<span>/{{formData.settle_type}}</span>
										</view> -->
										<!-- 人数 -->
										<!-- <span style="font-size: 12px;color: #9c9c9c;padding-left: 5px;white-space: nowrap;">1/{{formData.num}}人</span> -->
										<!-- </view> -->
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>


			<template #bottom>
				<!-- 底部导航条 -->
			</template>

		</z-paging>
	</view>

	<!-- <tabbs></tabbs> -->

	<u-toast ref="uToast"></u-toast>

	<!-- 海报 -->
	<u-overlay :show="showPost" @click="showPost = false">
		<view style="width: 650rpx;margin: 10px auto">
			<job-poster v-if="showPost" :qrcode-text="pageUrl('/')" @save="savePost"></job-poster>
		</view>
	</u-overlay>
</template>

<script>
	import jobData from '@/utils/data/workData.js'
	import timeTextFormat from '@/utils/mixins/time-text-format.js'
	import homePage from './social.vue'
	import tabbs from '@/pages/tabbs/tabbas.vue'
	import jobPoster from '@/components/posters/lime-painter.vue'

	//import ZPMixin from '@/uni_modules/z-paging/components/z-paging/js/z-paging-mixin'

	function Node(parent) {
		this.child = null
		this.parent = parent ? parent : null

		this.options = []
		this.options_key = null
		// this.option_key = null
		// this.option = null

		this._showTypeSel = false
	}

	Node.prototype.joinChild = function(child) {
		this.child = child
		child.parent = this
	}

	Node.prototype.getOptionKeys = function() {
		return this.getOptions() ? this.getOptions().map(option => option.key) : null
	}

	Node.prototype.getOptions = function() {
		if (!this.parent) return this.options

		if (this.parent.options_key && this.parent.getOption()) {
			let parentOption = this.parent.getOption()

			return parentOption && parentOption.childs ? parentOption.childs : null
		}

		return null
	}

	Node.prototype.getOption = function() {

		let options = this.getOptions()

		if (!options) return null

		return this.options_key ? options.find(option => option.key == this.options_key) : null
	}

	Node.prototype.setOptionKey = function(key) {
		this.options_key = key

		let child = this.child

		this.trave(i => i.setOptionKey(null))

		this._showTypeSel = false
	}

	Node.prototype.isSelected = function() {
		return this.options_key ? true : false
	}

	Node.prototype.isCanSelect = function() {
		return this.getOptions() ? true : false
	}

	Node.prototype.isShowTypeSel = function() {
		return this._showTypeSel ? true : false
	}

	Node.prototype.trave = function(fn, isChild = true) {
		let key = isChild ? 'child' : 'parent';
		let child = this[key];
		while (child) {
			fn(child);
			child = child[key]
		};
	}

	Node.prototype.showTypeSel = function() {
		if (!this.isCanSelect()) return

		if (!this._showTypeSel) //如果当前未显示,显示之前,关闭其他有的显示
		{
			this.trave(i => i._showTypeSel = false)
			this.trave(i => i._showTypeSel = false, false)
		}

		this._showTypeSel = !this._showTypeSel
	}

	function P(child) {
		let parent = new Node()
		parent.joinChild(child)
		return parent
	}

	let options = [{
			key: '广州',
			value: '1',
			childs: [{
				key: '天河',
				value: '1-1',
				childs: [{
					key: '员村街道',
					value: '1-1-1'
				}]
			}]
		},
		{
			key: '佛山',
			value: '2',
			childs: [{
					key: '禅城',
					value: '2-1',
					childs: [{
							key: '祖庙',
							value: '2-1-1'
						},
						{
							key: '石湾',
							value: '2-1-1'
						},
						{
							key: '张槎',
							value: '2-1-1'
						}
					]
				},
				{
					key: '顺德',
					value: '2-1',
					childs: [{
							key: '伦教',
							value: '2-2-1'
						},
						{
							key: '大良',
							value: '2-2-1'
						},
						{
							key: '北滘',
							value: '2-2-1'
						}
					]
				}
			]
		},
	]

	export default {
		components: {
			tabbs,
			jobPoster,
			homePage
		},
		mixins: [jobData, timeTextFormat],
		onShow() {

		},
		data() {
			return {
				tabIndex1: 0,
				// itinerary:null,
				inited: false,
				pins: [],
				showPost: false,
				isNoMore: false,
				lastNoMoreAt: null,
				showTypeSel: false,
				loadingDay: false,
				loading: false,
				currentDateIndex: 0,
				args: {
					withCredentials: true,
					lang: 'zh_CN'
				},
				workJobs: [],
				showPopup: false,
				_showPopup: false,
				title: 'Hello',
				tabList: [{
						name: '日程',
					},
					{
						name: '精选',
					},
					{
						name: '关注',
					}
				],
				currentTabIndex: 0,
				list1: [
					this.absUrl('/static/swipers/swiper1.png'),
					this.absUrl('/static/swipers/swiper2.png'),
					this.absUrl('/static/swipers/swiper3.png')
				],
			}

		},
		computed: {
			placeholdHeight() {
				return this.$device.statusBarHeight() + this.$device.navbarHeight()
			}
		},
		async onReady() {
			// if(this.loading)
			// {
			// 	this.$refs.uToast.show({
			// 		type:"loading",
			// 		show:"true",
			// 		message:"正在加载中",
			// 		duration:9999999
			// 	})
			// }

			// let components = await this.$geo.currentPos()

			// console.log(components)

			// console.log(this.$geo.getDistanceWGS84(113.293719,22.803751,113.29420,22.80377) + '米') //50米坐标
			// console.log(this.$geo.getDistanceWGS84(113.293719,22.803751,113.29466,22.80386) + '米') //100米坐标
			// console.log(this.$geo.getDistanceWGS84(113.293719,22.803751,113.29561,22.80409) + '米') //200米坐标
			// console.log(this.$geo.getDistanceWGS84(113.293719,22.803751,113.29659,22.80411 ) + '米') //300米坐标
			// console.log(this.$geo.getDistanceWGS84(113.293719,22.803751,113.29849,22.80388) + '米') //500米坐标

			setTimeout(() => {
				this.showPost = true
			}, 1000)
		},
		mounted() {
			let that = this

			// let root = new Node()
			// console.log(root)
			// let child = new Node()
			// root.addChild(child)

			// console.log(root)

			//let root = P(P(P(new Node())))

			function travseCount(arr = [], level = 0) {
				let maxLevel = 0
				arr.forEach(o => {
					maxLevel = Math.max(level, o.childs ? travseCount(o.childs, level + 1) : 0)
				})

				return maxLevel
			}

			let root = new Node()
			let parent = root
			this.pins.push(root)

			console.log(parent)
			console.log(root)

			for (let i = 0; i < travseCount(options); i++) {
				let node = new Node()
				parent.joinChild(node)
				parent = node
				this.pins.push(node)
			}

			root.options = options

			console.log(root)
			console.log(this.pins)

			this.pins[0].desc = '市'
			this.pins[1].desc = '区'
			this.pins[2].desc = '街'

			//console.log(root.getOptionKeys())
			//root.setOptionKey(root.getOptionKeys()[1])
			// console.log(root.getOptionKeys())
			// root.setOptionKey('B') 
			// console.log(root.child.getOptionKeys())
			// console.log(root.child.child.getOptionKeys())

			//if(this.itinerary.length == 0) return

			this.loading = true

			this.updateItinerary()
		},
		methods: {
			onTab1Click(item) {
				this.tabIndex1 = item.index
				console.log(this.tabIndex1)
			},
			async onConcern(task) {
				console.log('onConcern')
				
				this.$http.post('/user/concern/create', {
					publisher_id: task.creator_id
				})
			},
			async pullData(page, size) {

				// this.$refs.uToast.show({
				// 	type:"loading",
				// 	show:"true",
				// 	message:"正在加载中",
				// 	duration:9999999
				// })

				let url = ''

				if (this.currentTabIndex == 2) {
					url +=
						`/user/task/concerns?start_date=${this.currentDate}&page=${page}&size=${size}&type=recommend&user_id=${this.userStore.baseInfo.id}`
				} else {
					url = `/common/job/task/list?start_date=${this.currentDate}&page=${page}&size=${size}`
				}

				let res = await this.$http.get(
					url, {
						cache: this.$cache1m
					}
				)

				//this.$refs.uToast.hide()

				return res
			},
			async queryList(pageNo, pageSize) {

				let res = await this.pullData(pageNo, pageSize)

				this.$refs.paging.complete(res.data)

				//这里的pageNo和pageSize会自动计算好，直接传给服务器即可
				//这里的请求只是演示，请替换成自己的项目的网络请求，并在网络请求回调中通过this.$refs.paging.complete(请求回来的数组)将请求结果传给z-paging
				// this.$request.queryList({ pageNo,pageSize }).then(res => {
				// 	//请勿在网络请求回调中给dataList赋值！！只需要调用complete就可以了
				// 	this.$refs.paging.complete(res.data.list);
				// }).catch(res => {
				// 	//如果请求失败写this.$refs.paging.complete(false)，会自动展示错误页面
				// 	//注意，每次都需要在catch中写这句话很麻烦，z-paging提供了方案可以全局统一处理
				// 	//在底层的网络请求抛出异常时，写uni.$emit('z-paging-error-emit');即可
				// 	this.$refs.paging.complete(false);
				// })
			},
			savePost(picture) {
				this.showPost = false

				// #ifndef H5
				uni.saveImageToPhotosAlbum({
					filePath: picture,
					success(res) {
						uni.showToast({
							title: '已保存到相册',
							icon: 'success',
							duration: 2000
						});
					},
				});
				// #endif

				// #ifdef H5
				console.log(picture)
				uni.previewImage({
					current: 0,
					urls: [picture]
				})
				// #endif
			},
			// head(){
			// 	console.log('head')
			// 	//let obj = this.workJobs.shift()
			// 	//this.workJobs
			// 	this.workJobs.push(this.workJobs.shift())
			// },
			// tail(){
			// 	console.log('tail')
			// 	this.workJobs.pop()
			// },
			async pushData(page, scroll = false) {
				let that = this

				this.loadingDay = true
				// this.$refs.uToast.show({
				// 	type:"loading",
				// 	show:"true",
				// 	message:"正在加载中",
				// 	duration:9999999
				// })

				this.$http.get(`/common/job/task/list?start_date=${this.currentDate}&page=${page}&type=recommend`, {
					cache: this.$cache1m
				}).then((res) => {
					console.log(res.data)

					if (res.data.length > 0) {
						that.workJobs.push(...res.data)
						cosnole.log(res.data)
						that.currentPage = page

						if (page == 1 && scroll) {
							//setTimeout(()=>{
							uni.pageScrollTo({
								selector: "#sticky",
								duration: 200
							})
							//},200)
						}
					} else {
						// uni.showToast({
						// 	title:'没有更多了',
						// icon:'none'
						// })

						this.isNoMore = true
						this.lastNoMoreAt = Date.now();
					}

					that.loadingDay = false
					//that.$refs.uToast.hide()
				})
			},
			updateDay(start_date) {
				let that = this

				//this.w orkJobs = []
				this.currentDate = start_date

				//this.pushData(1,true);

				//this.$refs.paging.scrollToTop(false)

				this.$nextTick(() => {
					that.$refs.paging.reload()
				})
			},
			onClickDay(i, date) {
				this.currentDateIndex = i
				this.updateDay(date)
			},
			async onPhoneNumber(e) {
				console.log(e)
			},
			async getOpenId(e) {
				console.log(e);
				// let data = await this.decryptData(e.detail)
				// this.openId = data.openId

				// that.$u.vuex('user_info.openId',data.openId) 
				// console.log(data)
			},
			onClickType() {
				let that = this
				// uni.pageScrollTo({
				// 	scrollTop:1000,
				// 	selector:"#tabs",
				// 	duration: 100
				// })

				setTimeout(() => {
					that.showPopup = !that.showPopup
				}, 100)
				console.log("onClickType")
			},
			onHI() {
				console.log("HHIHI")
			},
			onConfirm(task) {
				console.log(task)

				this.pageParam.task_details = task

				uni.navigateTo({
					url: `/pages/job/user/job-details/job-details?id=${task.id}`,
				})
			},
			async updateItinerary() {
				this.itinerary = []

				let url = '/common/job/task/itinerary'

				if (this.currentTabIndex == 2) {
					url = '/user/task/concerns/itinerary'
				}

				let res = await this.$http.get(url, {
					cache: true
				})
				console.log(res.data)
				this.itinerary = res.data.itinerary
				this.today = res.data.today

				console.log(this.itinerary)
				this.loading = false
				this.currentDate = this.$dayjs().format('YYYY-MM-DD')
				this.inited = true
			},
			async onTabClick(e) {

				if (e.index == 2) await this.$refs.loginGurad.require()

				if (this.currentTabIndex == e.index) return

				this.currentTabIndex = e.index
				console.log(this.currentTabIndex)
				await this.updateItinerary()
				this.$refs.paging.reload()
			},
			onJob() {
				setTimeout(() => {
					uni.navigateTo({
						url: "/pages/job/details/details",

					})
				}, 500)
			},
			onJump() {
				// uni.navigateTo({
				// 	url:"/pages/enter/agent-register/agent-register"
				// })
				let url = '/v3/api/hi'

				// #ifndef H5 
				url = 'https://192.168.1.6/api/hi'
				//#endif

				// uni.request({
				// 	url,
				// 	method:'GET',
				// 	success(res) {
				// 		console.log(res)
				// 	},
				// 	fail(res) {
				// 		console.log(res)
				// 	}
				// })

				this.$http.get('/api/hi', {
					params: {
						'token': 123
					},
				}).then((res) => {
					console.log(res)
				})

				console.log('ooo')
			},
			guide(signMap) {
				uni.showLoading({
					title: '跳转中'
				});
				let {
					position
				} = this;
				if (position.name && position.name != '') {
					//地点位置position.name 地点经纬度lng lat
					var lng = position.longitude; //经度39.9
					var lat = position.latitude; //纬度116.4
					if (signMap == 0) {
						// 高德地图
						console.log('000')
						console.log(position.name, lng, lat, '1111')
						uni.getSystemInfo({

							success: (res) => {
								console.log(res)
								if (res.platform == "android") {
									window.location.href =
										"androidamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//判断是否跳转
									setTimeout(function() {
										let hidden = window.document.hidden || window.document
											.mozHidden || window.document.msHidden || window.document
											.webkitHidden
										if (typeof hidden == "undefined" || hidden == false) {
											//调用高德地图
											window.location.href =
												"https://uri.amap.com/marker?position=" + lng + "," +
												lat + "&name=" + position.name;
										}
									}, 2000);
								} else {
									window.location.href =
										"iosamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//判断是否跳转
									setTimeout(function() {
										let hidden = window.document.hidden || window.document
											.mozHidden || window.document.msHidden || window.document
											.webkitHidden
										if (typeof hidden == "undefined" || hidden == false) {
											//调用高德地图
											window.location.href =
												"https://uri.amap.com/marker?position=" + lng + "," +
												lat + "&name=" + position.name;
										}
									}, 2000);
								}
							}
						})
					} else if (signMap == 1) {
						// // 百度地图
						uni.getSystemInfo({
							success: (res) => {
								if (res.platform == "android") {
									let d = new Date();
									let t0 = d.getTime();
									window.location.href =
										"androidamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//由于打开需要1～2秒，利用这个时间差来处理－－打开app后，返回h5页面会出现页面变成app下载页面，影响用户体验
									var delay = setInterval(function() {
										var d = new Date();
										var t1 = d.getTime();
										if (t1 - t0 < 3000 && t1 - t0 > 2000) {
											window.location.href =
												"http://api.map.baidu.com/marker?location=" + lat +
												"," + lng + "&title=" + position.name +
												"&content=地点&output=html&src=webapp.baidu.openAPIdemo";
										}
										if (t1 - t0 >= 3000) {
											clearInterval(delay);
										}
									}, 1000);
								} else {
									let d = new Date();
									let t0 = d.getTime();
									window.location.href =
										"iosamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//由于打开需要1～2秒，利用这个时间差来处理－－打开app后，返回h5页面会出现页面变成app下载页面，影响用户体验
									let delay = setInterval(function() {
										var d = new Date();
										var t1 = d.getTime();
										if (t1 - t0 < 3000 && t1 - t0 > 2000) {
											window.location.href =
												"http://api.map.baidu.com/marker?location=" + lat +
												"," + lng + "&title=" + position.name +
												"&content=地点&output=html&src=webapp.baidu.openAPIdemo";
										}
										if (t1 - t0 >= 3000) {
											clearInterval(delay);
										}
									}, 1000);
								}
							}
						})
					} else {
						// // 腾讯地图
						uni.getSystemInfo({
							success: (res) => {
								if (res.platform == "android") {
									window.location.href =
										"androidamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//判断是否跳转
									setTimeout(function() {
										let hidden = window.document.hidden || window.document
											.mozHidden || window.document.msHidden || window.document
											.webkitHidden
										if (typeof hidden == "undefined" || hidden == false) {
											//调用腾讯地图
											window.location.href =
												`https://apis.map.qq.com/uri/v1/marker?marker=coord:(${lat},${lng})&addr:${position.name}`
										}
									}, 2000);
								} else {
									window.location.href =
										"iosamap://viewMap?sourceApplication=appname&poiname=" + position
										.name + "&lat=" + lat + "&lon=" + lng + "&dev=0";
									//判断是否跳转
									setTimeout(function() {
										let hidden = window.document.hidden || window.document
											.mozHidden || window.document.msHidden || window.document
											.webkitHidden
										if (typeof hidden == "undefined" || hidden == false) {
											//调用高德地图
											window.location.href =
												`https://apis.map.qq.com/uri/v1/marker?marker=coord:(${lat},${lng})&addr:${position.name}`
										}
									}, 2000);
								}
							}
						})
					}
				} else {
					uni.showToast({
						title: '暂不知道该地点位置',
						icon: 'none',
						duration: 2000,
					});
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	::v-deep [class^="u-swiper__wrapper__item__wrapper__"] {
		height: 100% !important;
		// width: 100% !important;
	}
</style>

<style>
	.status_bar {
		height: var(--status-bar-height);
		width: 100%;
	}

	.nav_bar {
		height: var();
		width: 100%;
	}

	.u-page .__slot-icon {
		width: 17px;
		height: 17px;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin: 200rpx auto 50rpx auto;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>